#include<iostream>
using namespace std;
int isBD(char c)
{
	if(c==','||c=='.'||c==' '||c=='?'||c=='!')  return 1;
	return 0;
}

int main()
{
	int i=0;
	char s[100];
	gets(s);
	while(s[i]!='\0')
	{
		while(isBD(s[i])==1&&s[i]!=0)
		{
			cout<<s[i];					
			i++;
		}
		int a = i;
		while(isBD(s[i])==0&&s[i]!=0)
			i++;
		int b = i-1;
		int m=a,n=b;
		while(m<n)
		{						
			char t = s[n];
			s[n]=s[m];
			s[m]=t;
			m++;
			n--;
		}
		for(int j=a;j<=b;j++)
			cout<<s[j];
	}
	return 0;
}
